package com.psnoted.backend.dto;

import io.swagger.v3.oas.annotations.media.Schema;

/**
 * 统一验证响应DTO
 * 用于统一登录流程的响应数据
 * 
 * @author PSNoted Team
 * @version 1.0.0
 */
@Schema(description = "统一验证响应")
public class UnifiedVerificationResponse {

    @Schema(description = "是否为新用户", example = "true")
    private boolean isNewUser;

    @Schema(description = "密钥哈希", example = "abc123def456...")
    private String keyHash;

    @Schema(description = "用户名", example = "testuser")
    private String username;

    @Schema(description = "用户信息")
    private UserInfo userInfo;

    /**
     * 用户信息内部类
     */
    @Schema(description = "用户详细信息")
    public static class UserInfo {
        @Schema(description = "用户名", example = "testuser")
        private String username;

        @Schema(description = "密钥哈希", example = "abc123def456...")
        private String keyHash;

        @Schema(description = "创建时间戳", example = "1640995200")
        private long createdAt;

        @Schema(description = "最后登录时间戳", example = "1640995200")
        private long lastLoginAt;

        public UserInfo() {}

        public UserInfo(String username, String keyHash, long createdAt, long lastLoginAt) {
            this.username = username;
            this.keyHash = keyHash;
            this.createdAt = createdAt;
            this.lastLoginAt = lastLoginAt;
        }

        // Getter和Setter方法
        public String getUsername() {
            return username;
        }

        public void setUsername(String username) {
            this.username = username;
        }

        public String getKeyHash() {
            return keyHash;
        }

        public void setKeyHash(String keyHash) {
            this.keyHash = keyHash;
        }

        public long getCreatedAt() {
            return createdAt;
        }

        public void setCreatedAt(long createdAt) {
            this.createdAt = createdAt;
        }

        public long getLastLoginAt() {
            return lastLoginAt;
        }

        public void setLastLoginAt(long lastLoginAt) {
            this.lastLoginAt = lastLoginAt;
        }

        @Override
        public String toString() {
            return "UserInfo{" +
                    "username='" + username + '\'' +
                    ", keyHash='" + keyHash + '\'' +
                    ", createdAt=" + createdAt +
                    ", lastLoginAt=" + lastLoginAt +
                    '}';
        }
    }

    // 默认构造函数
    public UnifiedVerificationResponse() {}

    // 全参构造函数
    public UnifiedVerificationResponse(boolean isNewUser, String keyHash, String username, UserInfo userInfo) {
        this.isNewUser = isNewUser;
        this.keyHash = keyHash;
        this.username = username;
        this.userInfo = userInfo;
    }

    // 简化构造函数
    public UnifiedVerificationResponse(boolean isNewUser, String keyHash, String username) {
        this.isNewUser = isNewUser;
        this.keyHash = keyHash;
        this.username = username;
    }

    // Getter和Setter方法
    public boolean isNewUser() {
        return isNewUser;
    }

    public void setNewUser(boolean newUser) {
        isNewUser = newUser;
    }

    public String getKeyHash() {
        return keyHash;
    }

    public void setKeyHash(String keyHash) {
        this.keyHash = keyHash;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public UserInfo getUserInfo() {
        return userInfo;
    }

    public void setUserInfo(UserInfo userInfo) {
        this.userInfo = userInfo;
    }

    @Override
    public String toString() {
        return "UnifiedVerificationResponse{" +
                "isNewUser=" + isNewUser +
                ", keyHash='" + keyHash + '\'' +
                ", username='" + username + '\'' +
                ", userInfo=" + userInfo +
                '}';
    }
} 